The object was created with the the ATL COM AppWizard. It contains two methods in it's interface.
HRESULT ChooseContent(BSTR bstrDataFile, BSTR* pbstrRetVal)
HRESULT GetAllContent(BSTR bstrDataFile)
ChooseContent
reads a collection of weighted entries from
bstrDataFile
and returns one entry in pbstrRetVal
.
Each entry is a piece of HTML text. It can be used as:
A data file for the Content Rotator looks like this:
%% // Tech Support people <a href="mailto:jsmith">John Smith</a>, Tech Lead %% <a href="mailto:bkidd">Billy (the) Kidd</a>, Trouble Shooter %% #3 // Jane is full-time, so make her the likeliest to be chosen <a href="mailto:jdoe">Jane Doe</a>, Product Support %% // Scare 'em away. Bwah ha ha! Sorry. Tech Support<br> is<br> on<br> <b>Strike!</b>It contains a number of weighted entries. The entries are HTML text. Each entry starts with one or more lines beginning with
%%
. If the
%%
line doesn't have anything on it (as in the one for Billy
Kidd), then the entry's weight is one. If there's a number preceded by a
#
(as in the Jane Doe example), then that's the weight.
Comments on the %%
line start with //
.
The probability of an entry's being chosen by the Content Rotator is its weight divided by the sum of the weights of all the entries (usually 1/n).
GetAllContent
reads a collection of weighted entries from
bstrDataFile
and writes all the entries back to the user's
browser, each one separated by a horizontal rule (an <HR> tag), so
that it can be proofread.
ChooseContent
method.
Click here to run a demonstration of the
GetAllContent
method.